//
//  WAUViewController.swift
//  iiatn
//
//  Created by mine on 18/4/26.
//  Copyright © 2018年 mnine. All rights reserved.
//

import UIKit
import SVProgressHUD

class WAUViewController: UIViewController {

    @IBOutlet var btn1: UIButton!
    
    @IBOutlet var btn2: UIButton!
    
    @IBOutlet var btn3: UIButton!
    
    @IBOutlet var btn4: UIButton!
    
    @IBOutlet var btn5: UIButton!
    
    @IBOutlet var text: UITextView!
    
        var btns = [UIButton]()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setstyle()
        setdosth()
        SVProgressHUD.dismiss()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    func setstyle(){
        btns.append(btn1)
        btns.append(btn2)
        btns.append(btn3)
        btns.append(btn4)
        btns.append(btn5)
        
        text.contentInset = UIEdgeInsets(top: 30, left: 5, bottom: 30, right: 5)
        text.width = SCREENW - 32
        text.layer.cornerRadius = text.height * 0.05
        text.layer.masksToBounds = true
        text.layer.rasterizationScale = UIScreen.main.scale
        for btn in btns {
            btn.width = SCREENW - 32
            btn.layer.cornerRadius = btn.height * 0.1
            btn.layer.masksToBounds = true
            btn.layer.rasterizationScale = UIScreen.main.scale
        }
    }
    
    func setdosth(){
        btn2.addTarget(self, action: #selector(toweb), for: .touchUpInside)
        btn3.addTarget(self, action: #selector(cpemail), for: .touchUpInside)
        btn4.addTarget(self, action: #selector(cptel), for: .touchUpInside)
        btn5.addTarget(self, action: #selector(cpaddress), for: .touchUpInside)
    }

    func cpemail(){
        UIPasteboard.general.string = "nnhzcjh@sina.com"
        SVProgressHUD.showInfo(withStatus: "邮箱 nnhzcjh@sina.com 已复制到粘贴板")
    }
    func cptel(){
        UIPasteboard.general.string = "01067171008"
        SVProgressHUD.showInfo(withStatus: "热线 010－67171008 已复制到粘贴板")
    }
    func cpaddress(){
        UIPasteboard.general.string = "北京市东城区白桥大街白桥南里甲2号"
        SVProgressHUD.showInfo(withStatus: "公司详细地址已经复制到粘贴板")
    }
    func toweb(){
        let detailVC = WWebViewToolController()
        detailVC.open_url = "http://www.china-ofdi.org"
        navigationController?.pushViewController(detailVC, animated: true)
    }
}
